php forum
php mysql forum
php mysql smarty
 
Topic Options
#271473 - 03/26/04 04:37 AM Finished-[6.3] Display Attachment Filename + Filesize
Twisty Offline
Code Monkey

Registered: 09/26/03
Posts: 524
Mod Name / Version: Display Attachment Filename + Filesize <br /> <br />Description: This mod will display the filename of an attachment as part of the attachment link (minus the attachment number) and display its filesize in kilobytes. <br /> <br />Its primary purpose is to allow your visitors to know which type of file they will be downloading beforehand, as well as know how large it is (in case they are on dial-up and have no interest in downloading something excessively large). <br /> <br />(I'm not sure whether this mod works in other versions besides 6.3) <br /> <br />DEMO <br />==== <br /> <br />http://www.mameworld.info/ubbthreads/sho...5b43dab728d49f4 <br /> <br /> <br />Working Under: UBB.Threads 6.3 <br /> <br />Mod Status: Finished <br /> <br />Any pre-requisites: <br /> <br />Author(s): Twisty <br /> <br />Date: 03/25/04 <br /> <br />Credits: <br /> <br />Files Altered: <br />showthreaded.php <br />showflat.php <br /> <br />New Files: <br /> <br />Database Altered: no <br /> <br />Info/Instructions: <br /> <br />1) In showthreaded.php... <br /> <br />CHANGE THIS: <br /> <br />
Code:
      if ($File) { <br />            $File = rawurlencode($File); <br />            if (!$downloads) {$downloads = 0; } <br />            $filelink = "&lt;a href=\"{$config['phpurl']}/download.php?Number=$Number\"&gt;{$ubbt_lang['FILE_ATTACH']}&lt;/a&gt; ($downloads {$ubbt_lang['DOWNLOADS']})&lt;br /&gt;"; <br />      }
<br />TO THIS: <br /> <br />
Code:
      if (($File) &amp;&amp; (strlen($File) &lt; 100)){ <br />            $File = rawurlencode($File); <br />            $Filecut = eregi_replace("^([0-9]+)-","",$File); <br />            $Filecut = eregi_replace("%20"," ",$Filecut); <br />            $Filecut = eregi_replace("%5C%27","'",$Filecut); <br />            $Filecut = eregi_replace("%21","!",$Filecut); <br />            $Filecut = eregi_replace("%40","@",$Filecut); <br />            $Filecut = eregi_replace("%23","#",$Filecut); <br />            $Filecut = eregi_replace("%24","$",$Filecut); <br />            $Filecut = eregi_replace("%25","%",$Filecut); <br />            $Filecut = eregi_replace("%5E","^",$Filecut); <br />            $Filecut = eregi_replace("%26","&amp;",$Filecut); <br />            $Filecut = eregi_replace("%28","(",$Filecut); <br />            $Filecut = eregi_replace("%29",")",$Filecut); <br />            $Filecut = eregi_replace("%5B","[",$Filecut); <br />            $Filecut = eregi_replace("%5D","]",$Filecut); <br />            $Filecut = eregi_replace("%7B","{",$Filecut); <br />            $Filecut = eregi_replace("%7D","}",$Filecut); <br />            $Filecut = eregi_replace("%60","`",$Filecut); <br />            $Filecut = eregi_replace("%2B","+",$Filecut); <br />            $Filecut = eregi_replace("%3D","=",$Filecut); <br />            $Filecut = eregi_replace("%7E","~",$Filecut); <br />            $Filecut = eregi_replace("%3B",";",$Filecut); <br />            $Filecut = eregi_replace("%A3","£",$Filecut); <br />            $Filecut = eregi_replace("%80","€",$Filecut); <br />            $Filecut = eregi_replace("%A5","¥",$Filecut); <br />            $Filecut = eregi_replace("%A7","§",$Filecut); <br />            $Filecut = eregi_replace("%A2","¢",$Filecut); <br />            $Filecut = eregi_replace("%2C",",",$Filecut); <br />            $attachpath="{$config['files']}/$File"; <br />            $attachpath= eregi_replace("%20"," ",$attachpath); <br />            $attachpath= eregi_replace("%5C%27","\'",$attachpath); <br />            $attachpath= eregi_replace("%21","!",$attachpath); <br />            $attachpath= eregi_replace("%40","@",$attachpath); <br />            $attachpath= eregi_replace("%23","#",$attachpath); <br />            $attachpath= eregi_replace("%24","$",$attachpath); <br />            $attachpath= eregi_replace("%25","%",$attachpath); <br />            $attachpath= eregi_replace("%5E","^",$attachpath); <br />            $attachpath= eregi_replace("%26","&amp;",$attachpath); <br />            $attachpath= eregi_replace("%28","(",$attachpath); <br />            $attachpath= eregi_replace("%29",")",$attachpath); <br />            $attachpath= eregi_replace("%5B","[",$attachpath); <br />            $attachpath= eregi_replace("%5D","]",$attachpath); <br />            $attachpath= eregi_replace("%7B","{",$attachpath); <br />            $attachpath= eregi_replace("%7D","}",$attachpath); <br />            $attachpath= eregi_replace("%60","`",$attachpath); <br />            $attachpath= eregi_replace("%2B","+",$attachpath); <br />            $attachpath= eregi_replace("%3D","=",$attachpath); <br />            $attachpath= eregi_replace("%7E","~",$attachpath); <br />            $attachpath= eregi_replace("%3B",";",$attachpath); <br />            $attachpath= eregi_replace("%A3","£",$attachpath); <br />            $attachpath= eregi_replace("%80","€",$attachpath); <br />            $attachpath= eregi_replace("%A5","¥",$attachpath); <br />            $attachpath= eregi_replace("%A7","§",$attachpath); <br />            $attachpath= eregi_replace("%A2","¢",$attachpath); <br />            $attachpath= eregi_replace("%2C",",",$attachpath); <br />            $attachfilesize = filesize($attachpath); <br />            $kbattachfilesize = $attachfilesize/1024; <br />            $finalattachfilesize = round($kbattachfilesize); <br />			if (!$downloads) {$downloads = 0; } <br />            $filelink = "&lt;a href=\"{$config['phpurl']}/download.php?Number=$Number\"&gt;{$ubbt_lang['FILE_ATTACH']}: $Filecut&lt;/a&gt; $finalattachfilesize KB ($downloads {$ubbt_lang['DOWNLOADS']})"; <br />      }
<br /> <br /> <br />2) In showflat.php... <br /> <br />CHANGE THIS: <br /> <br />
Code:
      if ($File) { <br />            $File = rawurlencode($File); <br />            if (!$downloads) { $downloads = "0"; } <br />            $postrow[$i]['filelink'] = "&lt;a href=\"{$config['phpurl']}/download.php?Number=$Number\"&gt;{$ubbt_lang['FILE_ATTACH']}&lt;/a&gt; ($downloads {$ubbt_lang['DOWNLOADS']})"; <br />      }
<br />TO THIS: <br /> <br />
Code:
      if (($File) &amp;&amp; (strlen($File) &lt; 100)){ <br />            $File = rawurlencode($File); <br />            $Filecut = eregi_replace("^([0-9]+)-","",$File); <br />            $Filecut = eregi_replace("%20"," ",$Filecut); <br />            $Filecut = eregi_replace("%5C%27","'",$Filecut); <br />            $Filecut = eregi_replace("%21","!",$Filecut); <br />            $Filecut = eregi_replace("%40","@",$Filecut); <br />            $Filecut = eregi_replace("%23","#",$Filecut); <br />            $Filecut = eregi_replace("%24","$",$Filecut); <br />            $Filecut = eregi_replace("%25","%",$Filecut); <br />            $Filecut = eregi_replace("%5E","^",$Filecut); <br />            $Filecut = eregi_replace("%26","&amp;",$Filecut); <br />            $Filecut = eregi_replace("%28","(",$Filecut); <br />            $Filecut = eregi_replace("%29",")",$Filecut); <br />            $Filecut = eregi_replace("%5B","[",$Filecut); <br />            $Filecut = eregi_replace("%5D","]",$Filecut); <br />            $Filecut = eregi_replace("%7B","{",$Filecut); <br />            $Filecut = eregi_replace("%7D","}",$Filecut); <br />            $Filecut = eregi_replace("%60","`",$Filecut); <br />            $Filecut = eregi_replace("%2B","+",$Filecut); <br />            $Filecut = eregi_replace("%3D","=",$Filecut); <br />            $Filecut = eregi_replace("%7E","~",$Filecut); <br />            $Filecut = eregi_replace("%3B",";",$Filecut); <br />            $Filecut = eregi_replace("%A3","£",$Filecut); <br />            $Filecut = eregi_replace("%80","€",$Filecut); <br />            $Filecut = eregi_replace("%A5","¥",$Filecut); <br />            $Filecut = eregi_replace("%A7","§",$Filecut); <br />            $Filecut = eregi_replace("%A2","¢",$Filecut); <br />            $Filecut = eregi_replace("%2C",",",$Filecut); <br />            $attachpath="{$config['files']}/$File"; <br />            $attachpath= eregi_replace("%20"," ",$attachpath); <br />            $attachpath= eregi_replace("%5C%27","\'",$attachpath); <br />            $attachpath= eregi_replace("%21","!",$attachpath); <br />            $attachpath= eregi_replace("%40","@",$attachpath); <br />            $attachpath= eregi_replace("%23","#",$attachpath); <br />            $attachpath= eregi_replace("%24","$",$attachpath); <br />            $attachpath= eregi_replace("%25","%",$attachpath); <br />            $attachpath= eregi_replace("%5E","^",$attachpath); <br />            $attachpath= eregi_replace("%26","&amp;",$attachpath); <br />            $attachpath= eregi_replace("%28","(",$attachpath); <br />            $attachpath= eregi_replace("%29",")",$attachpath); <br />            $attachpath= eregi_replace("%5B","[",$attachpath); <br />            $attachpath= eregi_replace("%5D","]",$attachpath); <br />            $attachpath= eregi_replace("%7B","{",$attachpath); <br />            $attachpath= eregi_replace("%7D","}",$attachpath); <br />            $attachpath= eregi_replace("%60","`",$attachpath); <br />            $attachpath= eregi_replace("%2B","+",$attachpath); <br />            $attachpath= eregi_replace("%3D","=",$attachpath); <br />            $attachpath= eregi_replace("%7E","~",$attachpath); <br />            $attachpath= eregi_replace("%3B",";",$attachpath); <br />            $attachpath= eregi_replace("%A3","£",$attachpath); <br />            $attachpath= eregi_replace("%80","€",$attachpath); <br />            $attachpath= eregi_replace("%A5","¥",$attachpath); <br />            $attachpath= eregi_replace("%A7","§",$attachpath); <br />            $attachpath= eregi_replace("%A2","¢",$attachpath); <br />            $attachpath= eregi_replace("%2C",",",$attachpath); <br />            $attachfilesize = filesize($attachpath); <br />            $kbattachfilesize = $attachfilesize/1024; <br />            $finalattachfilesize = round($kbattachfilesize); <br />			if (!$downloads) {$downloads = 0; } <br />            $postrow[$i]['filelink'] = "&lt;a href=\"{$config['phpurl']}/download.php?Number=$Number\"&gt;{$ubbt_lang['FILE_ATTACH']}: $Filecut&lt;/a&gt; $finalattachfilesize KB ($downloads {$ubbt_lang['DOWNLOADS']})"; <br />         }
<br /> <br />:-) <br /> <br />Disclaimer: Please backup every file that you intend to modify. <br />If the modification modifies the database, it's a good idea to backup your database before doing so. <br /> <br />Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Top
#271474 - 03/26/04 10:12 AM Re: Finished-[6.3] Display Attachment Filename + Filesize [Re: smoknz28]
slayer60 Offline
Junior Member

Registered: 06/14/03
Posts: 1185
Loc: New Boston, NH
Thanks. <img src="http://www.ubbdev.com/forum/images/graemlins/cool.gif" alt="" />

Top
#271475 - 03/26/04 11:01 AM Re: Finished-[6.3] Display Attachment Filename + Filesize [Re: BrokenToy]
ericgtr Offline
Junior Member

Registered: 05/12/03
Posts: 1109
Yes, looks like it would be a cool mod. Let us know when you get things going again so we can see the demo <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" />

Top
#271476 - 03/26/04 11:06 AM Re: Finished-[6.3] Display Attachment Filename + Filesize [Re: BlarC]
Twisty Offline
Code Monkey

Registered: 09/26/03
Posts: 524
As luck would have it, we're having an issue with our host right now. Their SQL server is temporarily offline, probably down for maintenace or repair (2nd time it's happened in about 6 months). <br /> <br />But don't worry, I'll announce when it returns :-) <br /> <br />twist
_________________________
Twisty []http://www.mameworld.info/misc/nana2.gif[/]
MAMEWorld

Top
#271477 - 03/26/04 11:33 AM Re: Finished-[6.3] Display Attachment Filename + Filesize [Re: smoknz28]
ericgtr Offline
Junior Member

Registered: 05/12/03
Posts: 1109
Ahh, happens to the best of us. Two times in six months isn't bad really.

Top
#271478 - 03/26/04 12:10 PM Re: Finished-[6.3] Display Attachment Filename + Filesize [Re: BlarC]
Twisty Offline
Code Monkey

Registered: 09/26/03
Posts: 524
Well good news, it's already back in action <img src="http://www.ubbdev.com/forum/images/graemlins/grin.gif" alt="" /> <br /><br />Demo here...<br /><br />http://www.mameworld.info/ubbthreads/sho...;o=&fpart=1
_________________________
Twisty []http://www.mameworld.info/misc/nana2.gif[/]
MAMEWorld

Top
#271479 - 03/26/04 12:30 PM Re: Finished-[6.3] Display Attachment Filename + Filesize [Re: smoknz28]
ericgtr Offline
Junior Member

Registered: 05/12/03
Posts: 1109
Cannot proceed, I registered and am waiting for my confirmation email, are you using approvals?

Top
#271480 - 03/26/04 12:59 PM Re: Finished-[6.3] Display Attachment Filename + Filesize [Re: BlarC]
ericgtr Offline
Junior Member

Registered: 05/12/03
Posts: 1109
I see now, nifty! Thanks <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" />

Top
#271481 - 08/06/04 11:33 AM Re: Finished-[6.3] Display Attachment Filename + Filesize [Re: BlarC]
slayer60 Offline
Junior Member

Registered: 06/14/03
Posts: 1185
Loc: New Boston, NH
This works for 6.4.3 as well. The only change seems to be in the spacing of the searched for text. For those copy and paste searches like myself:<br /><br />In showthreaded.php search for:<br />
Code:
<br />      if ($File) {<br />	 		$File = rawurlencode($File);<br />			if (!$downloads) {$downloads = 0; }<br />         $filelink = "&lt;a href=\"{$config['phpurl']}/download.php?Number=$Number\"&gt;{$ubbt_lang['FILE_ATTACH']}&lt;/a&gt; ($downloads {$ubbt_lang['DOWNLOADS']})&lt;br /&gt;";<br />      }<br />
<br /><br />In showflat.php search for:<br />
Code:
<br />         if ($File) {<br />	    		$File = rawurlencode($File);<br />				if (!$downloads) { $downloads = "0"; }<br />            $postrow[$i]['filelink'] = "&lt;a href=\"{$config['phpurl']}/download.php?Number=$Number\"&gt;{$ubbt_lang['FILE_ATTACH']}&lt;/a&gt; ($downloads {$ubbt_lang['DOWNLOADS']})";<br />         }<br />

Top



Moderator:  Ian_W 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks